package com.songlanyun.modules.apphome.controller.api;


import cn.hutool.core.map.MapUtil;
import com.songlanyun.common.config.resttplconfig.RestUtil;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;
import com.songlanyun.modules.account.controller.common.AbstractApiController;
import com.songlanyun.modules.account.service.AccountService;
import com.songlanyun.modules.apphome.model.vo.HomePageVO;
import com.songlanyun.modules.apphome.service.HomePageService;
import com.songlanyun.modules.marketing.firstorder.entity.FirstOrderActivity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;


/**
 * app 我的主页
 */
@RestController
@RequestMapping("api/homepage")
public class HomePageApiController extends AbstractApiController {


    @Resource
    private HomePageService homePageService;

    /**
     * 我的主页  -- 统计数据
     */
    @GetMapping("/my-statistics")
//    @RequiresPermissions("account:account:info")
    public R myStatistics(@RequestParam Map<String, Object> params) {
        HomePageVO vo = homePageService.myStatistics(setUserId(params));
        return R.ok().put("data", vo);
    }

    /**
     * 我的主页  -- 列表数据
     */
    @GetMapping("/my-list")
//    @RequiresPermissions("account:account:info")
    public R myList(@RequestParam Map<String, Object> params) {
        PageUtils page = homePageService.myList(setUserId(params));
        return R.ok().put("page", page);
    }
    
}
